package priv.wjh.study.dyn.controller.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import priv.wjh.study.dyn.controller.util.DynamicRegisterUtil;

@RestController
@RequestMapping("dyn")
public class DynController {


    @GetMapping("add")
    public void addController() throws Exception {
        DynamicRegisterUtil.registerController("testController");

    }

    @GetMapping("delete")
    public void deleteController(){
        DynamicRegisterUtil.unregisterController("testController");
    }


    @GetMapping("addBean")
    public void addBean(){
        DynamicRegisterUtil.registerBeanDefinition("dynamicRegisterUtil", DynamicRegisterUtil.class);
    }

    @GetMapping("deleteBean")
    public void deleteBean(){
        DynamicRegisterUtil.unRegisterBeanDefinition("dynamicRegisterUtil");
    }
}
